<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<%--
    Document   : blank
    Created on : 19.11.2008, 15:33:27
    Author     : pikaresk
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<body>
    <script src="js/curriculumstudent.js" type="text/javascript"></script>
    <%--<script src="js/jquery.tablesorter.min.js" type="text/javascript"></script>--%>

    <%@include file="systemMessage.jsp" %>

    <div id="box" class="rounded-divcascade">
        <div id="rightnow" class="rounded-top">
            <h3 class="reallynow">
                <span>Учебный журнал тьютора</span>
                <br />
            </h3>
        </div>

        <form id="form" class="rounded-formcascade">
            <fieldset>
                <legend>
                    <c:choose><c:when test="${isMyCurriculum == true}">
                            Ваши курсы
                        </c:when><c:otherwise>
                            Курсы тьютора ${name}
                        </c:otherwise></c:choose>
                    </legend>
                <c:choose>
                    <c:when test="${!empty courseBeanList}">
                        Выберите интересующий Вас курс из представленного ниже списка
                    </c:when><c:otherwise>
                        Список курсов пуст
                    </c:otherwise>
                </c:choose>
            </fieldset>





            <c:if test="${!empty courseBeanList}">

                <c:set var="i" value="-1" />
                <c:forEach items="${courseBeanList}" var="courseBean">
                    <c:set var="userData" value="${courseBean.userData}" />

                    <c:set var="i" value="${i+1}" />

                    <div id="rightnow">
                        <h3 class="reallynow" onclick="showCourseDiv(${userData.curriculumLevel.id});" style="cursor: help;"  title="Открыть учебный журнал по выбранному курсу">
                            <span>${userData.curriculumLevel.title}</span>
                            <a class="search_page" title="Подробнее о курсе" href="Course?id=${userData.curriculumLevel.id}" onclick="detailsClicked(event)">О курсе</a>
                            <br/>
                        </h3>


                        <div id="labsDiv_${userData.curriculumLevel.id}" style="display: none; width: 100%;">
                            <fieldset class="rounded" style="margin: 5px;">
                                <legend class="rounded">Информация</legend>

                                <label for="direction">Направление : </label>
                                <input name="direction" type="text" align="left"
                                       readonly="readonly" value="${userData.curriculumLevel.curriculumLevel.title}"/>

                                <label for="date">Дата назначения : </label>

                                <c:choose>
                                    <c:when test="${!empty userData.recordDate}">
                                        <input name="date" type="text" align="left"
                                               <%--readonly="readonly" value="${userData.recordDate.year+1900}.${userData.recordDate.month+1}.${userData.recordDate.date} - ${userData.recordDate.hours}:${userData.recordDate.minutes}" />--%>
                                               readonly="readonly" value="${fn:substring(userData.recordDate, 0, 16)}" />
                                    </c:when>
                                    <c:otherwise>
                                        <input name="date" type="text" align="left"
                                               readonly="readonly" value="" />
                                    </c:otherwise>
                                </c:choose>

                                <label for="description">Описание : </label>
                                <input type="button" value="Отобразить" style="width: 20%; cursor: pointer;" onclick="showDescription(${userData.curriculumLevel.id})"/>
                            </fieldset>



                            <c:choose>
                                <c:when test="${!empty courseBean.studentWithLabsList}">
                                    <div style="overflow-x: scroll">
                                        <table id="labsTable_${i}" style="width: 100%; overflow: hidden;" >
                                            <thead>
                                                <tr>
                                                    <%--                <th width="40px"><a href="#">ID<img src="img/icons/arrow_down_mini.gif" width="16" height="16" align="absmiddle" /></a></th>--%>
                                                    <%--<th width="20px"><a href="#">№</a></th>--%>
                                                    <th style="width: 92px; min-width: 92px; max-width: 92px;">Студент</th>

                                                    <c:forEach items="${courseBean.studentWithLabsList}" var="swl" begin="0" end="0" >
                                                        <c:forEach items="${swl.workItemList}" var="wi">
                                                            <th class="labHeader" id="${wi.id.task}" key="${wi.curriculumLevel.numeral}" style="vertical-align: top; width: 118px; min-width: 118px; max-width: 118px;">

                                                                <!--Работа -->№${wi.curriculumLevel.numeral}
                                                                <input style="width: 15px; cursor: help; margin-bottom: 0px; padding: 1px; float: right;" type="button" name="task" id="task${wi.id.task}" title="Задание" value="?" onclick="showDescription(${wi.curriculumLevel.id})"/>
                                                                <br/>
                                                                <a href="Lab?id=${wi.curriculumLevel.id}" title="Просмотреть описание практической работы">
                                                                    <div id="l_${wi.curriculumLevel.id}">
                                                                        ${(fn:substring(wi.curriculumLevel.title,0,50))}
                                                                    </div>
                                                                    <c:if test="${(fn:substring(wi.curriculumLevel.title,50,500)) != ''}">
                                                                        <div id="fl_${wi.curriculumLevel.id}" style="display: none">
                                                                            ${wi.curriculumLevel.title}
                                                                        </div>
                                                                    </c:if>
                                                                </a>
                                                                <c:if test="${(fn:substring(wi.curriculumLevel.title,50,500)) != ''}">
                                                                    <span style="cursor: pointer" title="развернуть/свернуть" onclick="toggleFullLabName(event, ${wi.curriculumLevel.id})">...</span>
                                                                </c:if>
                                                            </th>
                                                        </c:forEach>
                                                    </c:forEach>
                                                    <!--
                                                        <th width="40px"><a href="#">Операции</a></th>
                                                    -->
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <c:forEach items="${courseBean.studentWithLabsList}" var="swl">
                                                    <c:set var="lab" value="${labWorkItem.curriculumLevel}" />
                                                    <tr>
                                                        <td class="tdStudent"><a href="Profile?id=${swl.userIdentity.account}" title="Просмотреть профиль пользователя">${swl.userIdentity.name}</a></td>
                                                        <c:forEach items="${swl.workItemList}" var="wi">
                                                            <td align="center" key="${wi.id.id}:${wi.curriculumLevel.numeral}">
                                                                <span class="result" style="float: left; width: 77%; text-align: center;">
                                                                    <c:choose><c:when test="${wi.active}">
                                                                            <b title="Дата выполнения: ${fn:substring(wi.finish, 0, 16)}">Выполнено</b>
                                                                            <span title="Дата выполнения: ${fn:substring(wi.finish, 0, 16)}">${fn:substring(wi.finish, 0, 10)}</span>
                                                                        </c:when><c:otherwise>
                                                                            В процессе
                                                                        </c:otherwise></c:choose>
                                                                    </span>
                                                                <%--<span style="display: block;">--%>
                                                                <%--<span style="margin-left: 5px;">--%>
                                                                <span style="float: right; margin-right: 3px;">
                                                                    <c:choose>
                                                                        <c:when test="${! empty wi.mark && wi.mark != 0}">
                                                                            <input type="button" title="Подтвердить выполнение" style="display:none; width: 20px; margin-bottom: 0px; cursor: pointer;" onclick="setMark(event, ${wi.id.id}, ${wi.id.task});">
                                                                            <img src="img/tick-glow.png" alt="v" style="cursor: pointer;" onclick="cancelMark(event, ${wi.id.id}, ${wi.id.task})" title="Выполнение подтвердил проверяющий ${wi.accountByVerifier.userIdentity.name} - отменить?"/>
                                                                        </c:when><c:otherwise>
                                                                            <input type="button" title="Подтвердить выполнение" style="width: 20px; margin-bottom: 0px; cursor: pointer;" onclick="setMark(event, ${wi.id.id}, ${wi.id.task})">
                                                                            <img src="img/tick-glow.png" alt="v" style="display:none; cursor: pointer;" onclick="cancelMark(event, ${wi.id.id}, ${wi.id.task})" title="Выполнение подтвердил проверяющий <%= request.getRemoteUser()%> - отменить?"/>
                                                                        </c:otherwise>
                                                                    </c:choose>
                                                                </span>
                                                            </td>
                                                        </c:forEach>
                                                        <!--
                                                           <td>Операции</td>
                                                        -->
                                                    </tr>
                                                </c:forEach>
                                            </tbody>
                                        </table>
                                    </div>

                                    <!-- дополнительные свойства -->
                                    <c:if test="${!empty courseBean.userData.curriculumLevel.curriculumProperties}">
                                        <div>

                                            <c:forEach items="${courseBean.userData.curriculumLevel.curriculumProperties}" var="property">
                                                <c:forEach items="${property.additionalProperty.plugins}" var="plugin">
                                                    <c:if test="${plugin.enable}">
                                                        <c:choose>
                                                            <c:when test="${plugin.initType == 0}">
                                                                <a href="${plugin.initiate}">${plugin.name}</a>
                                                            </c:when>
                                                            <c:otherwise>
                                                                <c:if test="${plugin.initType == 1}">
                                                                    <script type="text/javascript" src="${plugin.initiate}"></script>
                                                                    <script type="text/javascript">
                                                                        ${plugin.additionalProperty.alias}(${i}, ${courseBean.userData.curriculumLevel.id});
                                                                        <%--display(${i}, ${courseBean.userData.curriculumLevel.id});--%>
                                                                    </script>
                                                                </c:if>
                                                            </c:otherwise>
                                                        </c:choose>
                                                    </c:if>
                                                </c:forEach>

                                                <%--<c:if test="${property.additionalProperty.alias == 'vtutoribm'}">
                                                    <div>
                                                        <script type="text/javascript" src="./../VirtualTutor1.5/JS/vtutoribm.js"></script>
                                                        <script type="text/javascript">
                                                            vtutoribm(${i}, ${courseBean.userData.curriculumLevel.id});
                                                        </script>
                                                    </div>
                                                </c:if>

                                                <!-- http://10.242.120.59:36462/VirtualTutorCognos/" target="_blank"><input type="button" value='Перейти к модулю "Виртуальный тьютор Cognos"'/></a> -->
                                                <c:if test="${property.additionalProperty.alias == 'vtutorcognos'}">
                                                    <br/>
                                                    <script type="text/javascript" src="http://5.127.67.114:36462/VirtualTutorCognos/JS/vtutorcognos.js"></script>
                                                        <script type="text/javascript">
                                                            try {
                                                            vtutorcognos();
                                                            } catch (e) {}
                                                        </script>
                                                </c:if>--%>
                                            </c:forEach>

                                        </div>
                                    </c:if>
                                </c:when><c:otherwise>
                                    <p>Список студентов пуст : <a href="SignStudents?courseId=${userData.curriculumLevel.id}">перейти к списку студентов</a></p>

                                </c:otherwise></c:choose>


                            </div>
                        </div>

                </c:forEach>

                <script type="text/javascript">reopenCourseDiv();</script>

            </c:if>
        </form>
    </div>

    <script type="text/javascript">
        $(document).ready(function() {
        <c:choose><c:when test="${isMyCurriculum == true}">
                $("#liCurriculum").addClass("current");
            </c:when><c:otherwise>
                    $("#liUsers").addClass("current");
            </c:otherwise></c:choose>
                    $('div#top-panel p').text('Прогресс выполнения дистанционных курсов студентами');
                });
    </script>
</body>


